package org.association.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.association.entity.AddressEntity;

@Mapper
public interface AddressDao extends BaseMapper<AddressEntity> {

    @Select("select content from address where used = 0 limit 1")
    String allocateAddress();

    @Update("update address set used = 1 where content = #{address}")
    void allocate(@Param("address") String address);
}
